<?php
session_start();
include 'message.php';

$couponName = $_POST['couponName'];
$message = $_POST['comments'];

$mysql_host = "mysql16.000webhost.com";
$mysql_database = "a1863493_venture";
$mysql_user = "a1863493_teamven";
$mysql_password = "teamventure1";


	
$link = mysql_connect($mysql_host, $mysql_user, $mysql_password); 

if (!$link) 
{
	die('Could not connect: ' . mysql_error());
} 
echo 'Connected successfully'; 
mysql_select_db($mysql_database, $link) or die ("Fail");

$name = $_SESSION['username'];

$query = mysql_query("SELECT idbus_acct FROM bus_acct WHERE name = '$name'");
$result = mysql_result($query,0);
saveMessage($message, $result);

$query = mysql_query("SELECT idmessage FROM message WHERE message = '$message' AND idbus_acct = '$result'");
$result = mysql_result($query,0);
sendMessage($result);
		

?>